//
//  TheNewCollectionReusableView.m
//  NewMusic
//
//  Created by dllo on 15/11/15.
//  Copyright © 2015年 Going. All rights reserved.
//

#import "TheNewCollectionReusableView.h"

@interface TheNewCollectionReusableView ()
//周数
@property(nonatomic, retain) UILabel *weekLabel;
//年数
@property(nonatomic, retain) UILabel *yearLabel;
//竖条
@property(nonatomic, retain) UILabel *lineLabel;
@end
@implementation TheNewCollectionReusableView
- (void)dealloc {
    [_weekLabel release];
    [_moreNewSongsModel release];
    [_yearLabel release];
    [_lineLabel release];
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        //创建视图
        [self createSubView];
    }
    return self;
}
#pragma mark 创建视图
- (void)createSubView {
    //竖条
    self.lineLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 5, 3, self.frame.size.height - 10)];
    self.lineLabel.backgroundColor = [UIColor cyanColor];
    [self addSubview:self.lineLabel];
    [self.lineLabel release];
    //周数
    self.weekLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 5, self.frame.size.width / 5, self.frame.size.height - 10)];
    self.weekLabel.font = [UIFont fontWithName:@"Georgia-BoldItalic" size:17];
    self.weekLabel.textColor = [UIColor whiteColor];
//    self.weekLabel.backgroundColor = [UIColor purpleColor];
    [self addSubview:self.weekLabel];
    [self.weekLabel release];
    //年份
    self.yearLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.frame.size.width - 70, self.weekLabel.frame.origin.y, 50, self.weekLabel.frame.size.height)];
    self.yearLabel.textColor = [UIColor whiteColor];
    self.yearLabel.font = [UIFont fontWithName:@"Georgia-BoldItalic" size:17];
    //    self.yearLabel.backgroundColor = [UIColor greenColor];
    [self addSubview:self.yearLabel];
    [self.yearLabel release];
}
#pragma mark 重写moreNewSongsModel的setter方法
- (void)setMoreNewSongsModel:(MoreNewSongsModel *)moreNewSongsModel {
    if (_moreNewSongsModel != moreNewSongsModel) {
        [_moreNewSongsModel release];
        _moreNewSongsModel = [moreNewSongsModel retain];
    }
    self.weekLabel.text = [NSString stringWithFormat:@"%@周", moreNewSongsModel.week];
    self.yearLabel.text = moreNewSongsModel.year;
}
@end
